﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<WebClient.Models.ViewModels.GroupViewModel>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>LogOnAdmin</title>
    <link href="/Content/AdminCSS/LogOn.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function submitForm() {
            if (ValidateLogin()) {
                $('#MySubmitForm').submit();
                // suppress default link action
                return true;
            } else {
                return false;
            }
        }

        function ValidateLogin() {
            var username = document.getElementsByName("LogOn_UserName").item(0);
            if (username.value == "") {
                document.getElementById("Validation_LogOn_UserName").innerHTML = "UserName is empty";
                return false;
            } else {
                document.getElementById("Validation_LogOn_UserName").innerHTML = "";
            }

            var password = document.getElementsByName("LogOn_Password").item(0);
            if (password.value == "") {
                document.getElementById("Validation_LogOn_Password").innerHTML = "Password is empty";
                return false;
            } else {
                document.getElementById("Validation_LogOn_Password").innerHTML = "";
            }
            return true;
        }
    </script>
    <script type="text/javascript">
		<% if (ViewData["LoginStatus"] != null){ %>
			alert('<%= ViewData["LoginStatus"] %>');
		<% } %>
	</script>
</head>
    <body>
        <div id="container">
            <div id="header">
                <div class="div1">
                    <a href="<%= Url.Action("Index", "Home") %>" style="font-size: 20px; font-weight: bold; color:#fff; text-decoration: none;">
                        <span><%= WebConfiguration.SiteName %></span>
                    </a>
                </div>
            </div>
            <div id="content">
                <div class="box" style="width: 325px; min-height: 300px; margin-top: 40px; margin-left: auto; margin-right: auto;">
                    <div class="left"></div>
                    <div class="right"></div>
                    <div class="heading">
                        <h1 style="background-image: url('../../Content/Images/LogOn/lockscreen.png');">Login information.</h1>
                    </div>
                    <div class="content" style="min-height: 150px;">
                       <% using (Html.BeginForm("LogOn", "Account", FormMethod.Post, new { id = "MySubmitForm" }))
                                                                          { %>
                            <table style="width: 100%;">
                                <tr>
                                    <td style="text-align: center; padding-bottom: 25px;" rowspan="4">
                                        <img src="../../Content/Images/LogOn/login.png" alt="Please enter your login details." />
                                    </td>
                                </tr>
                                <tr>
                                    <td>UserName:<br />
                                        <%= Html.TextBox("LogOn_UserName", "", new { @style = "width: 170px;" })%>
                                        <br />
                                        <span id="Validation_LogOn_UserName" style="color: Red;"></span>
                                        <br />
                                        Password:<br />
                                        <%= Html.Password("LogOn_Password", "", new { @style = "width: 170px;" })%>
                                        <br />
                                        <span id="Validation_LogOn_Password" style="color: Red;"></span>
                                    </td>
                                </tr>
                                <tr>
                                    <td>You forgot password? Press <a href="<%= Url.Action("ResetPassword", "Account") %>">here</a> to reset password</td>
                                </tr>
                                <tr>
                                    <td style="text-align: right;">
                                        <a onclick="submitForm()" href="#" class="button">
                                            <span>LogIn</span>
                                        </a>
                                    </td>
                                </tr>
                            </table>
                        <% } %>
                    </div>
                </div>
            </div>
        </div>
        <div id="footer">
            <a href="<%= Url.Action("Index", "Home") %>"><%= WebConfiguration.SiteName %></a> &copy; 2011-2012 All Rights Reserved.<br />Version 1.0.0
        </div>
    </body>
</html>
